/*
 * ImageEntity.cpp
 *
 *  Created on: Nov 28, 2009
 */

#include "ImageEntity.h"

//----------------	CONSTRUCTORS ----------------

ImageEntity::ImageEntity(int width, int height, int fileSize, int **vectorsR, int **vectorsG, int **vectorsB) {
	setWidth(width);
	setHeight(height);
	setFileSize(fileSize);

	setVectorsR(vectorsR);
	setVectorsG(vectorsG);
	setVectorsB(vectorsB);
}

ImageEntity::~ImageEntity() {
	for (int i = 0; i < getHeight(); i++) {
		if (vectorsR != NULL && vectorsR[i] != NULL) {
			vectorsR[i] = 0;
			delete []vectorsR[i];
		}

		if (vectorsG != NULL && vectorsG[i] != NULL) {
			vectorsG[i] = 0;
			delete vectorsG[i];
		}

		if (vectorsB != NULL && vectorsB[i] != NULL) {
			vectorsB[i] = 0;
			delete vectorsB[i];
		}

	}

	vectorsR = 0;
	vectorsG = 0;
	vectorsB = 0;
	delete []vectorsR;
	delete []vectorsG;
	delete []vectorsB;
}

int ImageEntity::getVectorRValue(int x, int y) const {
	return getVectorsR()[x][y];
}

int ImageEntity::getVectorGValue(int x, int y) const {
	return getVectorsG()[x][y];
}

int ImageEntity::getVectorBValue(int x, int y) const {
	return getVectorsB()[x][y];
}

//	GETs AND SETs
int ImageEntity::getHeight() {
	return height;
}
void ImageEntity::setHeight(int height) {
	this->height = height;
}
int ImageEntity::getWidth() {
	return width;
}
void ImageEntity::setWidth(int width) {
	this->width = width;
}
int **ImageEntity::getVectorsR() const {
	return this->vectorsR;
}
void ImageEntity::setVectorsR(int **vectorsR) {
	this->vectorsR = vectorsR;
}
int **ImageEntity::getVectorsG() const {
	return this->vectorsG;
}
void ImageEntity::setVectorsG(int **vectorsG) {
	this->vectorsG = vectorsG;
}
int **ImageEntity::getVectorsB() const {
	return this->vectorsB;
}
void ImageEntity::setVectorsB(int **vectorsB) {
	this->vectorsB = vectorsB;
}
int ImageEntity::getFileSize() {
	return fileSize;
}
void ImageEntity::setFileSize(int fileSize) {
	this->fileSize = fileSize;
}
